package init.luoyu.action.lambda;


import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * <p>高校学生录取规则</p>
 * @author LuoYu
 * 2020/11/24
 **/
public class UniversityStudentFilter {


    public static List<Student> filter(List<Student> resources){
        if(resources == null || resources.isEmpty()){
            return Collections.emptyList();
        }
        List<Student> result = new ArrayList<>();
        for (Student student : resources) {
            if(student.getScore()>= 500 && student.getIsFresh()){
                result.add(student);
            }
        }
        return result;
    }



    public static List<Student> filter2(List<Student> resources){
        if(resources == null || resources.isEmpty()){
            return Collections.emptyList();
        }
        List<Student> result = new ArrayList<>();
        for (Student student : resources) {
            SubjectScore score = student.getResults();
            int total = score.getChines() + score.getEnglish() + score.getMathematics();
            if(student.getScore()>= 520 && total >= 300){
                result.add(student);
            }
        }
        return result;
    }















}
